Page({
  data: {

  },

  // 跳转到具体内容页并把具体内容作为参数传到二级页面
  gotoContent: function (e) {
    //获取绑定的参数
    var data = e.currentTarget.dataset;
    console.log(data)
    wx.navigateTo({
      url: '/pages/forum_content/forum_content?id=' + data.id,
    })
  },

  contentGet: function (e) {
    var that = this;
    wx.request({
      url: 'http://localhost:8080/forum/forum',
      method: 'POST',
      success: function (res) {
        var message = res.data;
        console.log(message);
        if (message == null) {
          var toastText = '数据获取失败';
          wx.showToast({
            title: toastText,
            icon: '',
            duration: 2000
          });
        } else {
          that.setData({
            message: res.data
          })
        }
      }
    })
  },

  gotoRelease: function (e) {
    wx.navigateTo({
      url: '/pages/forum/forum_release/forum_release',
    })
  },
  
  onLoad: function () {
    this.contentGet()
  },

  onShow: function () {
    this.contentGet()
  },
})